package com.seele.tigerwallet.api;

import com.google.gson.JsonElement;
import com.seele.tigerwallet.ui.utils.GsonUtil;

import retrofit2.Call;

public abstract class APIObjectCallBack<T> extends APICallBack<T> {
    @Override
    protected void onObjectResponse(JsonElement jsonElement) {
        T response = GsonUtil.parseJsonWithGson(jsonElement, getType());
        if (null!=response){
            onResponse(response);
        }else {
            onResponseError(new APIException(APIException.GSONERROR));
        }

    }

    protected abstract void onResponse(T response);
}
